<?php
/**
 * @version        $Id: buy.php 1 8:38 2010年7月9日Z tianya $
 * @package        DedeCMS.Member
 * @copyright      Copyright (c) 2007 - 2010, DesDev, Inc.
 * @license        http://help.dedecms.com/usersguide/license.html
 * @link           http://www.dedecms.com
 */
require_once(dirname(__FILE__).'/config.php');
CheckRank(0,0);
$menutype = 'mydede';
$menutype_son = 'buy';
$myurl = $cfg_basehost.$cfg_member_dir.'/index.php?uid='.$cfg_ml->M_LoginID;
$moneycards = '';
$membertypes = '';
$dsql->SetQuery("SELECT * FROM #@__moneycard_type ");
$dsql->Execute();
while($row = $dsql->GetObject())
{
    $row->money = sprintf("%01.2f", $row->money);
    $moneycards .= "<li><label><input type='radio' name='pid' value='{$row->tid}'> 充值 <span class='m-p'>&yen;{$row->pname}</span>, 可获得 <span class='m-p'>{$row->num}</span> 金币</label></li>
    ";
}
$dsql->SetQuery("SELECT #@__member_type.*,#@__arcrank.membername,#@__arcrank.money as cm From #@__member_type LEFT JOIN #@__arcrank on #@__arcrank.rank = #@__member_type.rank order by #@__member_type.aid");
$dsql->Execute();
$user = $dsql->GetOne("SELECT * FROM #@__member WHERE mid='{$cfg_ml->M_ID}'");
while($row = $dsql->GetObject())
{
    $row->money = sprintf("%01.2f", $row->money); 
    $membertypes .= "<li><div _typeid='{$row->aid}'>";

    if ($row->discount > 0) {
        $membertypes .= "<p class='hykt_p'>{$row->pname}({$row->discount}折)</p>";
    } else {
        $membertypes .= "<p class='hykt_p'>{$row->pname}</p>";
    }

    if($row->discount_money && $row->end_time > date('Y-m-d H:i:s') && $row->discount_money != 0){
        $membertypes .="￥<del style='font-size: 12px'>{$row->money}</del>
	    <h6 class='hykt_h'><span>￥{$row->discount_money}</span></h6>";
    }else{
        $membertypes .="<h6 class='hykt_h'><span>￥{$row->money}</span></h6>";
    }
    $membertypes .= "<span class='icons icon_xz'></span>
	<input type=\"submit\" class=\"hysj_button\" value=\"立即开通\" style='width: 90px;'>
	<span style='margin-top:5px'>
     <i>vip权限：</i><br/>
     <i>全网素材均可下载</i><br/>
     <i>无需人工干预，自动升级</i><br/>
     ";
     if($row->exptime >= 365){
         $membertypes .="<i>每日素材<b style='color:red'>50</b>下载</i><br/>";
     }else{
         $membertypes .="<i>每日限制下载30个素材</i><br/>";
     }

     $membertypes .= "</span>
    </div></li>
    ";
     $end_time = $row->end_time;
}
$tpl = new DedeTemplate();
$tpl->LoadTemplate(DEDEMEMBER.'/templets/buy.htm');
$tpl->Display();